package com.itheima.cotroller;

import com.itheima.common.entity.PageResult;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.common.entity.Result;
import com.itheima.sercive.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.itheima.pojo.Order;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/findPage")
    public Result findPage(@RequestBody QueryPageBean queryPageBean) {
        PageResult pageResult =orderService.findPage(queryPageBean);
        return Result.success(pageResult);
    }

    @PutMapping("/update")
    public Result updateStatus(@RequestBody Order order) {
        return orderService.updateStatus(order);
    }
}